programming4us
           
 
 
Sharepoint

Working with the SharePoint 2010 Management Shell (part 4) - Understanding Properties and Methods

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
12/13/2010 2:44:36 PM
1.2. Understanding Properties and Methods

Everything that SharePoint knows about an object is stored in data elements and values known as properties, which also describe the state of that object. For example, the SPContentDatabase object contains all the information about the content databases within the farm.

Objects not only have properties, they also contain actions that determine how they can be manipulated. In object-oriented terminology, these actions, or different ways of acting on an object, are called methods. To determine the properties and methods for the SPSite object, use the cmdlets in the following example, where a portion of the output is shown.

PS C:\Users\peter> Get-SPSite | Get-Member


   TypeName: Microsoft.SharePoint.SPSite
Name MemberType Definition
---- ---------- ----------
AddWorkItem Method System.Guid AddWorkItem(Sys...
BypassUseRemoteApis Method System.Void BypassUseRemote...
CheckForPermissions Method System.Void CheckForPermiss...
Close Method System.Void Close()
ConfirmUsage Method bool ConfirmUsage()
Delete Method System.Void Delete(), Syste...
Dispose Method System.Void Dispose()
...
ToString Method string ToString()
UpdateValidationKey Method System.Void UpdateValidatio...
VisualUpgradeWebs Method System.Void VisualUpgradeWe...
AdministrationSiteType Property Microsoft.SharePoint.SPAdmi...
AllowDesigner Property System.Boolean AllowDesigne...
AllowMasterPageEditing Property System.Boolean AllowMasterP...
....(not all output shown)
WarningNotificationSent Property System.Boolean WarningNotif...
WebApplication Property Microsoft.SharePoint.Admini...
WorkflowManager Property Microsoft.SharePoint.Workfl...
WriteLocked Property System.Boolean WriteLocked ...
Zone Property Microsoft.SharePoint.Admini...



Note:

BEST PRACTICE Never miss an opportunity to pipe the Get-SP<noun> cmdlet to the Get-Member cmdlet. It is sometimes surprising what information an object is able to retrieve.


Real World: Performance Issues When Running Windows PowerShell Commands

If you want to find all the site collections in the farm, you can type Get-SPSite. However, the only output you will see is the URL of the site collections. For performance reasons, the Url property is the only property displayed by default. This is because site collections have many properties; if you display all of these properties for a large number of site collections, you will consume a large amount of memory, and the command will take a long time to run. Displaying just the Url property is almost instantaneous because it is cached. Therefore, you should refrain from running this command to display more than a few additional properties.


To display more than the default property, you can use the select Windows PowerShell cmdlet with the pipe (|) character. You also can use the wildcard character (*) with the select statement to list all the property values, as shown in the following example.

PS C:\Users\Peter> Get-SPSite "http://teams" | select *


ApplicationRightsMask                 : FullMask
ID : cbf3290e-000e-4768-953c-99a983430283
SystemAccount : SHAREPOINT\system
Owner : CONTOSO\spadmin
SecondaryContact : CONTOSO\peter
GlobalPermMask : FullMask
IISAllowsAnonymous : False
Protocol : http:
HostHeaderIsSiteName : False
HostName : teams
Port : 80
...(not all output shown)
AllowDesigner : True
AllowRevertFromTemplate : False
AllowMasterPageEditing : False
ShowURLStructure : False


To get a list of all site collections in your farm, together with the name of the content database where they are stored (output that gives only the URL of the site collection and the content database name), you would use the commands as shown in the following example, which also shows the sample output.

PS C:\Users\peter> Get-SPSite | select url, contentdatabase


Url                                     ContentDatabase
--- ---------------
http://MySite SPContentDatabase Name=Contoso_MySiteDB
http://MySite/personal/peter SPContentDatabase Name=Contoso_PersonalDB
http://MySite/personal/erin SPContentDatabase Name=Contoso_PersonalDB
http://intranet.contoso.msft SPContentDatabase Name=Contoso_IntranetDB
http://teams SPContentDatabase Name=Contoso_TeamsDB
http://teams/sites/Finance SPContentDatabase Name=Contoso_TeamsDB

Other -----------------
- SharePoint 2010 : Edit the Contents of a Page
- SharePoint 2010 : Change the Page Layout of a Publishing Page
- SharePoint 2010 : Authoring Pages - Edit the Properties of a Page
- SharePoint 2010 : Authoring Pages - Create a New Page (part 2)
- SharePoint 2010 : Authoring Pages - Create a New Page (part 1)
- SharePoint 2010 : Managing Systems Remotely with WinRM
- SharePoint 2010 : Installing Windows PowerShell
- SharePoint 2010 : Using Windows PowerShell: The Basics
- SharePoint 2010 : Modify a View
- SharePoint 2010 : Create Mobile Views
- Uninstalling SharePoint 2010
- Configuring a SharePoint 2010 Installation (part 1) - Renaming the Central Administration Database
- Configuring a SharePoint 2010 Installation (part 1) - Running the Farm Configuration Wizard
- SharePoint 2010 : Enable or Disable Inline Editing in a View
- Performing SharePoint 2010 Installations (part 5)
- Performing SharePoint 2010 Installations (part 4)
- Performing SharePoint 2010 Installations (part 3)
- Performing SharePoint 2010 Installations (part 2)
- Performing SharePoint 2010 Installations (part 1) - SharePoint 2010 Standalone Installation
- SharePoint 2010 : Specify the Item Limit for a View
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us